package com.ccb.sc.common.modules.order.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * 物流状态
 * @author ken
 * @version 1.0
 * @date 2020-09-25
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@Getter
public enum DeliverStatus implements IEnum<Integer> {

    /**
     * 待发货
     */
    WAIT_DELIVER(0, "待发货"),

    /**
     * 已发货
     */
    SHIPPED(1, "已发货"),

    /**
     * 已评价
     */
    RECEIVED(2, "已签收"),

    ;

    private int value;
    private String desc;

    DeliverStatus(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static DeliverStatus getByValue(int value) {
        for (DeliverStatus orderStatus : DeliverStatus.values()) {
            if (value == orderStatus.getValue()) {
                return orderStatus;
            }
        }
        return null;
    }
}
